package com.createthread.p2;

/**
 * @PackageName:com.createthread.p2
 * @ClassName:Test
 * @Description: 演示线程运行结果的随机性
 * @Author: zhangxiaoyu
 * @date 2020/11/18 14:25
 */
public class Test {
    public static void main(String[] args){
        MyThread01 myTest = new MyThread01();
        myTest.start();

        try {
            for(int i =1;i<=10;i++){
                System.out.println("main:"+i);

                //随机数
                int  time = (int) (Math.random()*1000);
                //线程休眠，单位是毫秒 1s=1000ms
                Thread.sleep(time);
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }
}
